#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>

struct S
{
	int a;
	int arr[0];
};
int main()
{
	struct S*s=(struct S*)malloc(sizeof(struct S) + 20 * sizeof(int));
	if (s == NULL)
	{
		perror("struct S");
		return 1;
	}
	s->a = 5;
	int i = 0;
	for(i = 0; i < 20; i++)
	{
		s->arr[i] = i + 1;

	}
	struct S* ptr = (struct S*)realloc(s, sizeof(struct S) + 40 * sizeof(int));
	if (ptr != NULL)
	{
		s = ptr;
	}
	for (i = 0; i < 40; i++)
	{
		printf("%d ", s->arr[i]);
	}
	free(s);
	s = NULL;

	return 0;
}